#include<stdio.h>
#include<string.h>
#define N 1000
int main()
{
	char a[N];
	int i , j=0, l[N]={0} , lenmax=0 , len[N]={0} , xb=0 ;
	scanf( "%s" , a );
	for( i=1; i<=strlen(a)-1 ; i++ )
	{
		/*if(a[i]=='0' || a[i-1]=='0' )
		{
			j++;
			continue;
		}	
		else*/
		if( a[i]-a[i-1]==1 || a[i]==a[i-1] )
		{
			l[j] = i;
			len[j]++;
		}
		else
			j++;
	}
	for( i=0; i<strlen(a) ; i++ )
		if( lenmax < len[i] )
		{
			lenmax = len[i];
			xb = l[i];
		}
	for( i = xb-lenmax ; i <= xb ; i++ )
		printf( "%c" , a[i] );
	return 0;
}
